package test;

import ch02.classPath.Entry.CompositeEntry;
import ch02.classPath.Entry.DirEntry;
import ch02.classPath.Entry.Entry;

import java.io.IOException;

public class testCh02 {
    public static void main(String[] args) {
        test1();
        test2();
    }

    public static void test1(){
        try {
            DirEntry dirEntry = new DirEntry("F:\\mine-jvm\\out\\production\\mine-jvm\\ch01");
            byte[] bytes = dirEntry.readClass("Cmd.class");
            System.out.println(bytes.length);

            System.out.println(dirEntry.string());
        } catch (ClassNotFoundException | IOException e) {
            System.out.println("error");
            e.printStackTrace();
        }
    }

    public static void test2(){
        String str = "F:\\mine-jvm\\out\\production\\mine-jvm\\ch01;F:\\mine-jvm\\out\\production\\mine-jvm\\ch02\\classPath\\Entry";

        try {
            Entry entry = new CompositeEntry(str);
            byte[] classData = entry.readClass("Entry.class");
            System.out.println(classData.length);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
